package com.jwdf.uda.http.action;

import android.content.Context;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;

import retrofit2.Call;

/**
 * 类说明：
 * 作者：huangqiuxin on 2016/5/13 18:23
 * 邮箱：648859026@qq.com
 */
public class VerifyMobileAction extends AHttpService<PbBean.PbResUserVerifyMobile> {
    /**
     * 验证手机
     *
     * @param context
     * @param verificationCode
     * @return
     */
    public static VerifyMobileAction newInstance(Context context, String mobile, String verificationCode) {
        return new VerifyMobileAction(context, mobile, verificationCode);
    }

    private String mobile;
    private String verificationCode;

    private VerifyMobileAction(Context context, String mobile, String verificationCode) {
        super(context);
        this.verificationCode = verificationCode;
        this.mobile = mobile;
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqUserVerifyMobile.Builder builder = PbBean.PbReqUserVerifyMobile.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setMobile(mobile);
        builder.setVerificationCode(verificationCode);

        return apiService.verifyMobile(builder.build());
    }
}
